<template>
  <div class="item">
    <img :src="item.formIcon ? item.formIcon : defaultFormIcon"></img>
    <div class="title text-overflow">
      {{item.formName ? item.formName : ''}}
    </div>
    <div class="descript text-overflow">
      {{item.description ? item.description : ''}}&nbsp;
    </div>
    <div class="oper-line">
      <span class="icon-box" title="编辑" @click="$emit('operation', Object.assign({type: 1}, item))">
        <i class="el-icon el-icon-edit"></i>
      </span>
      <span v-if="!item.published" class="icon-box" title="删除" @click="$emit('operation', Object.assign({type: 2}, item))">
        <i class="el-icon el-icon-delete" style="color: #F56C6C;"></i>
      </span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'formItem',
  props: ['item'],
  data() {
    return {
      defaultFormIcon: require('../../../icons/png/form-default.png')
    }
  },
  created() {
  },
  methods: {}
}
</script>

<style lang='scss' scoped>
.item {
  width: 280px;
  height: 300px;
  margin: 20px;
  text-align: center;
  padding: 20px;
  font-size: 16px;

  .oper-line {
    display: none;
    color: #477fe3;
    margin: 8px 0;

    .icon-box {
      display: inline-block;
      padding: 0 8px;
      cursor: pointer;
    }
  }

  &:hover {
    box-shadow: 4px 4px 4px rgba(0, 0, 0, 0.3);

    .oper-line {
      display: block;
    }
  }

  img {
    width: 180px;
    height: 180px;
  }

  .title {
    font-weight: 900;
    margin: 12px 0;
  }

  .descript {
    color: #999;
    line-height: 1em;
  }
}
</style>
